package space.xxhui.binderdemo.interfaceImp;

import android.os.IBinder;

import space.xxhui.binderdemo.IBookManager;

/**
 * Created by hui on 2016/10/13.
 */

public class DeathRecipientImp implements IBinder.DeathRecipient {

    private IBookManager bookManager;

    public DeathRecipientImp() {
    }

    public DeathRecipientImp(IBookManager bookManager) {
        this.bookManager = bookManager;
    }

    @Override
    public void binderDied() {
        if(bookManager ==null){
            return;
        }
        bookManager.asBinder().unlinkToDeath(this,0);
        bookManager = null ;
        //这里重新绑定远程Service
    }
}
